package cn.gailvlun.gll.presentation.chat.adapter

import android.content.Context
import cn.gailvlun.gll.R
import cn.gailvlun.gll.bean.SelectHolder
import cn.gailvlun.gll.net.base.Profile
import com.github.markzhai.recyclerview.SingleTypeAdapter

class CreateGroupAdapter : SingleTypeAdapter<SelectHolder<Profile>> {
    constructor(context: Context?) : super(context, R.layout.item_create_group)

    fun getData(): List<SelectHolder<Profile>> {
        return mCollection
    }

    fun getSelectedList(): List<SelectHolder<Profile>> {
        return mCollection.filter {
            it.selected
        }
    }

    fun getSelectIdList() : List<Int> {
        return getSelectedList().map {
            it.data.id
        }
    }

    fun getHowManySelected(): Int {
        return getSelectedList().size
    }
}